# 普通代理  告诉你我使用了代理 告诉你真实IP地址
# 匿名代理  告诉你我使用了代理 不会告诉我的真实ip地址
# 高匿代理  不会告诉使用了代理，更不会告诉真实ip地址

# 218.76.38.93
# script type="text/javascript" data-compress="off"
'''
{"serialNo":"24fd3bea47a94ae7bfda3896866146a1","code":0,"data":
[{"realIp":"124.94.252.175","pid":6,"cid":40,"area":"辽宁-鞍山","ip":"112.28.228.47","port":26619},
 {"realIp":"27.153.80.130","pid":22,"cid":261,"area":"福建-泉州","ip":"112.28.228.38","port":43979}]}
'''

# import requests

# url = 'https://www.baidu.com/s?ie=UTF-8&wd=ip'
head_data = {
    # 字典，需要有一个键值对
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
}

#
# proxies = {
#     'HTTPS':'112.28.228.35:28828'
# }
# html = requests.get(url, proxies=proxies, headers=head_data)
# print(html.text)

s = '''
{"serialNo":"19386186d3274ba0b6c3c37d71c2c703","code":0,"data":[{"realIp":"119.41.201.200","pid":30,"cid":367,"area":"海南-海口","ip":"112.28.228.35","port":28828},{"realIp":"39.72.193.189","pid":13,"cid":124,"area":"山东-日照","ip":"112.28.228.48","port":25532},{"realIp":"175.173.222.138","pid":6,"cid":34,"area":"辽宁-盘锦","ip":"112.28.228.47","port":40517},{"realIp":"116.8.114.106","pid":20,"cid":214,"area":"广西-桂林","ip":"112.28.228.38","port":44136},{"realIp":"27.157.130.167","pid":22,"cid":260,"area":"福建-三明","ip":"112.28.228.39","port":29142}]}
'''
import requests

for dic in eval(s)["data"]:
    ip = dic["ip"]
    port = dic["port"]
    proxyUrl = "http://" + ip + ":" + str(port)
    proxy = {"http": proxyUrl}
    r = requests.get("https://www.baidu.com/s?ie=UTF-8&wd=ip", headers=head_data, proxies=proxy)
    print("status Code : " + str(r.status_code))
    print(r.text)



